package main

import (
	"flag"
	"fmt"
	"path/filepath"
	"runtime"
	"telemple_web/app"
	"telemple_web/app/http"
)

func main() {
	//解析命令行传参
	homePath := flag.String("prjHome", "", "项目根路径")
	flag.Parse()
	if *homePath == "" {
		_, f, _, ok := runtime.Caller(0)
		if !ok {
			panic("获取配置文件出错")
		}
		*homePath = filepath.Dir(f)
	}

	fmt.Println(*homePath)
	err := app.Init(*homePath)
	if err != nil {
		panic("配置文件转换失败:" + err.Error())
	}

	///zerolog 测试代码
	//log.InitLogs()

	err = http.NerServer()
	if err != nil {
		panic("gin 启动失败:" + err.Error())
	}

}
